package com.ysd.util;

import com.google.gson.Gson;

/**
 * 处理结果
 * 
 * @author Administrator
 *
 */
public class Result {
	public boolean success;
	public String message;
	public String remark;

	public static String toClient(boolean suc, Object msg) {
		Result r = new Result();
		r.success = suc;
		r.message = msg.toString();
		r.remark = "";
		Gson t = new Gson();
		return t.toJson(r);
	}

	// 方法有static的优势之一, 就是可以直接通过"类名.方法名()"来进行访问
	public static String toClient(boolean suc, Object msg, String remark) {//false, "上传失败", "图片过大"
		Result r = new Result();
		r.success = suc; //false
		r.message = msg.toString(); //上传失败
		r.remark = remark; //图片过大
		Gson t = new Gson();
		return t.toJson(r);
	}
	
	
	
}